package Day15;

/**
 * @author HYHwtx
 * @version 1.0
 * @date 2022/2/22 10:43
 */

/*
 *1.编写一个Person类，包括属性/private name，age ，构造器，方法say返回自我介绍的字符串
 *2.编写一个Student的一个类，继承Person类，增加id score属性/private以及构造器，定义say方法（返回自我介绍的信息)* 3.在main中，分别创建Person和Student对象，调用say方法输出自我介绍
 */

public class Person {
    private int age;
    private String name;


    public Person(int age, String name) {
        super();
        this.age = age;
        this.name = name;
    }

    public int getAge() {

        return age;
    }

    public void setAge(int age) {

        this.age = age;
    }

    public String getName() {

        return name;
    }

    public void setName(String name) {

        this.name = name;
    }


    public String say() {

        return "我叫 ："+name+"，今年"+age+"岁";
    }

    public static void main(String[] args) {
        Student student = new Student( 18,"张三",20207896,100);
        System.out.println(student.printfInfo());
    }
}
class Student extends Person{
    private int id;
    private int score;

    public Student(int age, String name) {

        super(age, name);
    }

    public Student(int age, String name, int id, int score) {
        super(age, name);
        this.id = id;
        this.score = score;
    }

    public int getId() {

        return id;
    }

    public void setId(int id) {

        this.id = id;
    }

    public int getScore() {

        return score;
    }

    public void setScore(int score) {

        this.score = score;
    }
    public String printfInfo(){

        return say()+"，我的学号是："+id+"，我的分数是："+score;
    }
}